<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="content">
            <h:form styleClass="jsfcrud_list_form">
                <p:panel header="Enployees By Department">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListSystemUserEntityEmpty}" rendered="#{systemUserEntityController.currentUser.department.employees.size() == 0}"/>
                    <h:panelGroup rendered="#{systemUserEntityController.currentUser.department.employees.size() > 0}">
                        <p:dataTable value="#{systemUserEntityController.currentUser.department.employees}" var="item" 
                                     paginator="true" rows="50">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSystemUserEntityTitle_department}"/>
                                </f:facet>
                                <h:outputText value="#{item.department.name}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSystemUserEntityTitle_id}"/>
                                </f:facet>
                                <h:outputText value="#{item.id}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSystemUserEntityTitle_name}"/>
                                </f:facet>
                                <h:outputText value="#{item.name}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSystemUserEntityTitle_title}"/>
                                </f:facet>
                                <h:outputText value="#{item.title}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSystemUserEntityTitle_firstName}"/>
                                </f:facet>
                                <h:outputText value="#{item.firstName}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSystemUserEntityTitle_lastName}"/>
                                </f:facet>
                                <h:outputText value="#{item.lastName}"/>
                            </h:column>                           
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="email"/>
                                </f:facet>
                                <h:outputText value="#{item.contact.email}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="number"/>
                                </f:facet>
                                <h:outputText value="#{item.contact.contactNumber}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <h:commandLink action="#{systemUserEntityController.prepareView}" value="#{bundle.ListSystemUserEntityViewLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{systemUserEntityController.prepareEdit}" value="#{bundle.ListSystemUserEntityEditLink}" />
                                <h:outputText value=" "/>
                                <h:commandLink action="#{systemUserEntityController.destroy}" value="Deactivate"/>
                            </h:column>
                        </p:dataTable>
                    </h:panelGroup>            
                </p:panel>
                <br />
                <h:commandButton action="#{systemUserEntityController.prepareCreate}" value="#{bundle.ListSystemUserEntityCreateLink}"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
